<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Class: Origami::Reference</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Class</strong></td>
          <td class="class-name-in-header">Origami::Reference</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../../files/origami/reference_rb.html">
                origami/reference.rb
                </a>
        <br />
                <a href="../../files/origami/obfuscation_rb.html">
                origami/obfuscation.rb
                </a>
        <br />
            </td>
        </tr>

        <tr class="top-aligned-row">
            <td><strong>Parent:</strong></td>
            <td>
                <a href="Object.html">
                Object
               </a>
            </td>
        </tr>
        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">

    <div id="description">
      <p>
Class representing a <a href="Reference.html">Reference</a> <a
href="Object.html">Object</a>. <a href="Reference.html">Reference</a> are
like symbolic links pointing to a particular object into the file.
</p>

    </div>


   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000581">&lt;=&gt;</a>&nbsp;&nbsp;
      <a href="#M000580">eql?</a>&nbsp;&nbsp;
      <a href="#M000578">new</a>&nbsp;&nbsp;
      <a href="#M000584">real_type</a>&nbsp;&nbsp;
      <a href="#M000579">solve</a>&nbsp;&nbsp;
      <a href="#M000582">to_a</a>&nbsp;&nbsp;
      <a href="#M000585">to_obfuscated_str</a>&nbsp;&nbsp;
      <a href="#M000583">value</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->
    <div id="includes">
      <h3 class="section-bar">Included Modules</h3>

      <div id="includes-list">
        <span class="include-name"><a href="Object.html">Origami::Object</a></span>
      </div>
    </div>

    <div id="section">


    <div id="constants-list">
      <h3 class="section-bar">Constants</h3>

      <div class="name-list">
        <table summary="Constants">
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">REGEXP_TOKEN</td>
          <td>=</td>
          <td class="context-item-value">Regexp.new(TOKENS.first, Regexp::MULTILINE)</td>
        </tr>
        </table>
      </div>
    </div>



    <div id="attribute-list">
      <h3 class="section-bar">Attributes</h3>

      <div class="name-list">
        <table>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">refgen</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">refno</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        </table>
      </div>
    </div>
      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Class methods</h3>

      <div id="method-M000578" class="method-detail">
        <a name="M000578"></a>

        <div class="method-heading">
          <a href="#M000578" class="method-signature">
          <span class="method-name">new</span><span class="method-args">(refno, refgen)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000578-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000578-source">
<pre>
    <span class="ruby-comment cmt"># File origami/reference.rb, line 41</span>
41:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">refno</span>, <span class="ruby-identifier">refgen</span>)
42:       <span class="ruby-ivar">@refno</span>, <span class="ruby-ivar">@refgen</span> = <span class="ruby-identifier">refno</span>, <span class="ruby-identifier">refgen</span>
43:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000581" class="method-detail">
        <a name="M000581"></a>

        <div class="method-heading">
          <a href="#M000581" class="method-signature">
          <span class="method-name">&lt;=&gt;</span><span class="method-args">(ref)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000581-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000581-source">
<pre>
    <span class="ruby-comment cmt"># File origami/reference.rb, line 82</span>
82:     <span class="ruby-keyword kw">def</span> <span class="ruby-operator">&lt;=&gt;</span>(<span class="ruby-identifier">ref</span>) <span class="ruby-comment cmt">#:nodoc</span>
83:       <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">to_a</span> <span class="ruby-operator">&lt;=&gt;</span> <span class="ruby-identifier">ref</span>.<span class="ruby-identifier">to_a</span>
84:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000580" class="method-detail">
        <a name="M000580"></a>

        <div class="method-heading">
          <a href="#M000580" class="method-signature">
          <span class="method-name">eql?</span><span class="method-args">(ref)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000580-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000580-source">
<pre>
    <span class="ruby-comment cmt"># File origami/reference.rb, line 74</span>
74:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">eql?</span>(<span class="ruby-identifier">ref</span>) <span class="ruby-comment cmt">#:nodoc</span>
75:       <span class="ruby-identifier">ref</span>.<span class="ruby-identifier">refno</span> <span class="ruby-operator">==</span> <span class="ruby-ivar">@refno</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">ref</span>.<span class="ruby-identifier">refgen</span> <span class="ruby-operator">==</span> <span class="ruby-ivar">@refgen</span>
76:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000584" class="method-detail">
        <a name="M000584"></a>

        <div class="method-heading">
          <a href="#M000584" class="method-signature">
          <span class="method-name">real_type</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000584-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000584-source">
<pre>
     <span class="ruby-comment cmt"># File origami/reference.rb, line 104</span>
104:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">real_type</span> ; <span class="ruby-constant">Reference</span> <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000579" class="method-detail">
        <a name="M000579"></a>

        <div class="method-heading">
          <a href="#M000579" class="method-signature">
          <span class="method-name">solve</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000579-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000579-source">
<pre>
    <span class="ruby-comment cmt"># File origami/reference.rb, line 57</span>
57:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">solve</span>
58:       
59:       <span class="ruby-identifier">pdfdoc</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">pdf</span>
60: 
61:       <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">pdfdoc</span>.<span class="ruby-identifier">nil?</span>
62:         <span class="ruby-identifier">raise</span> <span class="ruby-constant">InvalidReferenceError</span>, <span class="ruby-value str">&quot;Not attached to any PDF&quot;</span>
63:       <span class="ruby-keyword kw">end</span>
64:       
65:       <span class="ruby-identifier">target</span> = <span class="ruby-identifier">pdfdoc</span>.<span class="ruby-identifier">get_object</span>(<span class="ruby-keyword kw">self</span>)
66:       
67:       <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">target</span>.<span class="ruby-identifier">nil?</span>
68:         <span class="ruby-identifier">raise</span> <span class="ruby-constant">InvalidReferenceError</span>, <span class="ruby-node">&quot;Cannot resolve reference : #{self.to_s}&quot;</span>
69:       <span class="ruby-keyword kw">end</span>
70: 
71:       <span class="ruby-identifier">target</span>
72:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000582" class="method-detail">
        <a name="M000582"></a>

        <div class="method-heading">
          <a href="#M000582" class="method-signature">
          <span class="method-name">to_a</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Returns a Ruby array with the object number and the generation this
reference is pointing to.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000582-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000582-source">
<pre>
    <span class="ruby-comment cmt"># File origami/reference.rb, line 89</span>
89:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_a</span>
90:       [<span class="ruby-ivar">@refno</span>, <span class="ruby-ivar">@refgen</span>]
91:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000585" class="method-detail">
        <a name="M000585"></a>

        <div class="method-heading">
          <a href="#M000585" class="method-signature">
          <span class="method-name">to_obfuscated_str</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000585-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000585-source">
<pre>
     <span class="ruby-comment cmt"># File origami/obfuscation.rb, line 165</span>
165:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_obfuscated_str</span>
166:       <span class="ruby-identifier">refstr</span> = <span class="ruby-identifier">refno</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-constant">Obfuscator</span>.<span class="ruby-identifier">junk_spaces</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">refgen</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-constant">Obfuscator</span>.<span class="ruby-identifier">junk_spaces</span> <span class="ruby-operator">+</span> <span class="ruby-value str">&quot;R&quot;</span>
167: 
168:       <span class="ruby-keyword kw">super</span>(<span class="ruby-identifier">refstr</span>)
169:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000583" class="method-detail">
        <a name="M000583"></a>

        <div class="method-heading">
          <a href="#M000583" class="method-signature">
          <span class="method-name">value</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Returns self.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000583-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000583-source">
<pre>
     <span class="ruby-comment cmt"># File origami/reference.rb, line 100</span>
100:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">value</span>
101:       <span class="ruby-keyword kw">self</span>
102:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>